-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.1] - Add command to view mview state and queue #12050
[2.1] - Add command to view mview state and queue #12050
Conversation
This is similar to the magerun1 command here: netz98/n98-magerun#891 I like the ability to view the mview queue in realtime as its being processed, it can be quite helpful when debugging indexing issues. This command will actually show how many items are in the list pending processing, as well information from the `mview_state` table. ``` php bin/magento indexer:status:mview +---------------------------+----------+--------+---------------------+------------+---------+ | ID | Mode | Status | Updated | Version ID | Backlog | +---------------------------+----------+--------+---------------------+------------+---------+ | catalog_category_product | enabled | idle | 2017-11-02 10:00:00 | 1 | 0 | | catalog_product_attribute | enabled | idle | 2017-11-02 10:00:00 | 1 | 1 | | catalog_product_category | disabled | idle | 2017-11-02 10:00:00 | 1 | 0 | | catalog_product_price | enabled | idle | 2017-11-02 10:00:00 | 1 | 0 | +---------------------------+----------+--------+---------------------+------------+---------+ ``` I'll point this PR into 2.1.x and raise a separate PR to pop it into 2.2.x.
9ca0c5c
to
e08cc35
Compare
Really good idea. Would be great to have something similar in the magento admin. |
@ihor-sviziev That would definitely be neat, however I'll focus on getting this command and potentially deal with admin UI in a separate PR at a later. |
e08cc35
to
c0078be
Compare
private $mviewIndexersCollection; | ||
|
||
public function __construct( | ||
\Magento\Framework\Mview\View\CollectionInterface $collection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use \Magento\Framework\Mview\View\CollectionFactory there. Also would be great to import this class.
} | ||
|
||
$rows[] = [ | ||
$indexer->getData('view_id'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to use $indexer->getId()
$rows = []; | ||
|
||
/** @var \Magento\Framework\Mview\View $indexer */ | ||
foreach ($this->mviewIndexersCollection as $indexer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it's not indexer, it's view. So it's better to use one name for this object type
|
||
$rows[] = [ | ||
$indexer->getData('view_id'), | ||
$state->getData('mode'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$state->getMode()
$rows[] = [ | ||
$indexer->getData('view_id'), | ||
$state->getData('mode'), | ||
$state->getData('status'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$state->getStatus()
$indexer->getData('view_id'), | ||
$state->getData('mode'), | ||
$state->getData('status'), | ||
$state->getData('updated'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$state->getUpdated()
$state->getData('mode'), | ||
$state->getData('status'), | ||
$state->getData('updated'), | ||
$state->getData('version_id'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$state->getVersionId()
Thanks for the review @ihor-sviziev I'll action these later. Quick Q: why is it your preference to use |
You're looking on implementation. If you look on interface - you'll see
that there is no method getData, but has all methods that I wrote you.
|
@ihor-sviziev thank you for the clarification, you were right I was not considering the interface. i've updated the PR to address your concerns and the test suite is green, please review. |
Cool, now that this is going green I'll port it to 2.2. |
Done. Raised #12122 for the 2.2 series. |
FYI I'll not do any further work on this PR until everyone's happy with the changes and discussion that will be happening in #12122 . |
[EngCom] Public Pull Requests - 2.1-develop - MAGETWO-85180: [Backport 2.1-develop] Fix swagger-ui on instances of Magento running on a non-standard port #12579 - MAGETWO-85097: [Backport-2.1] Added namespace to product videos fotorama events #12558 - MAGETWO-83478: Add command to view mview state and queue #12050
Description
This is similar to the magerun1 command here: netz98/n98-magerun#891
I like the ability to view the mview queue in realtime as its being processed, it can be quite helpful when debugging indexing issues.
This command will actually show how many items are in the list pending processing, as well information from the
mview_state
table.Manual testing scenarios
php bin/magento indexer:set-mode schedule catalog_product_price
_cl
tablephp bin/magento indexer:status:mview
to see the backlog increasemagerun2 sys:cron:run indexer_update_all_views
will trigger the mview processesContribution checklist